import request from '@utils/ajax'
import store from '../store/index'

export const getCircleList = (last_id, type) => {
  return request({
    url: 'applet/circle/list',
    auth: store.state.user.token ? true : false,
    data: {
      size: 10,
      last_id,
      type
    }
  })
}

export const follow = f_user_id => {
  return request({
    url: 'applet/circle/follow',
    method: 'POST',
    data: {
      f_user_id,
      type: 1
    }
  })
}

export const unfollow = f_user_id => {
  return request({
    url: 'applet/circle/follow',
    method: 'POST',
    data: {
      f_user_id,
      type: 2
    }
  })
}

export const report = content_id => {
  return request({
    url: 'applet/circle/accusation',
    method: 'POST',
    data: {
      content_id
    }
  })
}

export const getComments = () => {
  return request({
    url: 'applet/circle/commentList'
  })
}

export const getTotal = () => {
  return request({
    url: 'applet/circle/commentNum'
  })
}

export const getPersonInfo = user_id => {
  return request({
    auth: store.state.user.token ? true : false,
    url: 'applet/circle/circleCentreUserInfo',
    data: {
      user_id
    }
  })
}

export const getDetail = content_id => {
  return request({
    auth: store.state.user.token ? true : false,
    url: 'applet/circle/detail',
    data: {
      content_id
    }
  })
}

export const getPersonCircles = (user_id, last_id) => {
  return request({
    auth: false,
    url: 'applet/circle/circleCentre',
    data: {
      user_id,
      last_id,
      size: 10
    }
  })
}

export const publish = data => {
  return request({
    url: 'applet/circle/publishCircle',
    method: 'POST',
    data
  })
}

export const publishComment = data => {
  return request({
    url: 'applet/circle/publishComment',
    method: 'POST',
    data
  })
}

export const readAllComment = () => {
  return request({
    url: 'applet/circle/readAllComment',
    method: 'POST'
  })
}
